from tortoise import BaseDBAsyncClient


async def upgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `attr` ALTER COLUMN `_type` SET DEFAULT 'static';
        ALTER TABLE `attr` MODIFY COLUMN `_type` VARCHAR(32) NOT NULL  COMMENT '属性类型,static:静态；dynamic:动态' DEFAULT 'static';
        ALTER TABLE `attr` MODIFY COLUMN `_type` VARCHAR(32) NOT NULL  COMMENT '属性类型,static:静态；dynamic:动态' DEFAULT 'static';"""


async def downgrade(db: BaseDBAsyncClient) -> str:
    return """
        ALTER TABLE `attr` MODIFY COLUMN `_type` VARCHAR(32)   COMMENT '属性类型';
        ALTER TABLE `attr` ALTER COLUMN `_type` DROP DEFAULT;
        ALTER TABLE `attr` MODIFY COLUMN `_type` VARCHAR(32)   COMMENT '属性类型';"""
